package top.huiwow.utils;

import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;

public class WorldUtils {
    public static List<LivingEntity> getNearbyMobs(Player player, double range) {
        List<LivingEntity> list = new ArrayList<>();
        for (Entity entity : player.getNearbyEntities(range, range, range)) {
            if (entity instanceof LivingEntity && !(entity instanceof Player)) {
                list.add(((LivingEntity) entity));
            }
        }
        return list;
    }
}
